package com.fwmagic.spark.other.core

import org.apache.spark.sql.{DataFrame, SparkSession}

object SaveAsTextFileDemo {
  def main(args: Array[String]): Unit = {
    val spark: SparkSession = SparkSession
      .builder()
      .appName("ActionOperation")
      .master("local[*]")
      .getOrCreate()

    val dataFrame: DataFrame = spark.read.json("/Users/fangwei/learn/mycode/workspace/fwmagic-spark/src/main/resources/employee.json")
    val rdd1 = dataFrame
    rdd1.coalesce(1).write.json("/tmp/ccc")
    spark.stop()
  }
}
